"""
安装脚本

用于将Ubuntu Environment Validator安装为Python包
支持开发模式安装和生产环境部署
"""

from setuptools import setup, find_packages
import os

# 读取README文件作为长描述
def read_readme():
    """读取README文件内容"""
    readme_path = os.path.join(os.path.dirname(__file__), 'README.md')
    if os.path.exists(readme_path):
        with open(readme_path, 'r', encoding='utf-8') as f:
            return f.read()
    return "Ubuntu环境自动化验证工具"

# 读取requirements文件
def read_requirements():
    """读取依赖文件"""
    req_path = os.path.join(os.path.dirname(__file__), 'requirements.txt')
    if os.path.exists(req_path):
        with open(req_path, 'r', encoding='utf-8') as f:
            return [line.strip() for line in f if line.strip() and not line.startswith('#')]
    return []

setup(
    name="ubuntu-env-validator",
    version="1.0.0",
    author="System Integration Engineer",
    author_email="admin@example.com",
    description="Ubuntu环境自动化验证工具",
    long_description=read_readme(),
    long_description_content_type="text/markdown",
    url="https://github.com/your-org/ubuntu-env-validator",
    packages=find_packages(),
    classifiers=[
        "Development Status :: 4 - Beta",
        "Intended Audience :: System Administrators",
        "Topic :: System :: Systems Administration",
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "Operating System :: POSIX :: Linux",
    ],
    python_requires=">=3.8",
    install_requires=read_requirements(),
    entry_points={
        'console_scripts': [
            'ubuntu-validator=src.main:main',
        ],
    },
    include_package_data=True,
    package_data={
        'src': ['*.yaml', '*.yml'],
    },
    extras_require={
        'dev': [
            'pytest>=6.0',
            'pytest-asyncio>=0.18',
            'black>=22.0',
            'flake8>=4.0',
        ],
    },
)